<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>forgot</title>
	<link rel="stylesheet" type="text/css" href="__CSS__/default.css">
	<link href="__CSS__/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="__CSS__/index/styles.css">
	<script src="__JS__/jquery-3.2.1.min.js"></script>
	<style>
		.btn{
			position: absolute; top: 0px;right: 0;height: 41px;BORDER-RIGHT: #FFE400 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #FFE400 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px;
		}
		.error{
			list-style: none;
		}
	</style>
</head>
<body>

<div class='login'>
	<button style="position: absolute;top: 4px;left: 19px;" class="button button-large button-plain button-border button-circle"><a href="#" onClick="javascript :history.back(-1);"><i class="fa fa-reply"></i></a></button>
	<div class='login_title'>
		<span>找回密码</span>
	</div>
	<form id="form">
		<div class='login_fields'>
			<div class='login_fields__user'>
				<div class='icon'>
					<img style="width: 14px;height: 14px;" src='__IMAGES__/index/phone.png'>
				</div>
				<input placeholder='邮箱' name="phone" id="phone"  type='text'  >
				<div class='validation'>
					<img src='__IMAGES__/index/tick.png'>
				</div>
				<input class="btn" id="button" type="button" value="获取验证码">
			</div>
			<div class='login_fields__user' id="yam" style="display: none">
				<div class='icon'>
					<img style="width: 14px;height: 14px;" src='__IMAGES__/index/yzm.png'>
				</div>
				<input placeholder='验证码' id="yzm" onblur="yzyam(this)" type='text'>
				<div class='validation'>
					<img src='__IMAGES__/index/tick.png'>
				</div>
			</div>
			<div class='login_fields__password' id="newpas" style="display: none">
				<div class='icon'>
					<img src='__IMAGES__/index/lock_icon_copy.png'>
				</div>
				<input placeholder='新密码' id="psw" type='password' name="password">
				<div class='validation'>
					<img src='__IMAGES__/index/tick.png'>
				</div>
			</div>
			<div class='login_fields__submit'>
				<input type='button' value='找回' id="submit">
				<div class='forgot'>
					<a style="text-decoration:none;" href="{:url('Index/register')}">注册！</a> <a style="text-decoration:none;" href="{:url('Index/login')}">登录?</a>
				</div>
			</div>
			</div>
	</form>
</div>
</body>
<script type="text/javascript" src="__JS__/index/jquery-ui.min.js"></script>
<script  src="__JS__/1.js"></script>
<script SRC="__JS__/register.js"></script>
<script>
	var url="{:url('login/show')}";

		$("#button").on("click",function(){
			$.ajax({
				url:url,
				data: {
					phone:$("#phone").val()
				},
				dataType:"json",
				type:"post",
				success:function(data){
					if(data.state=="true"){
//						alert(data.yzm);
						yzm=data.yzm;
						$("#yam").css("display","block");
						alert("发送成功")
					}else{
						alert("发送失败")
					}
				},
				error:function(e){
					alert(e.response)
				}
			})
	})
			$("#submit").on("click",function(){
			$.ajax({
				url:"{:url('Login/newpas')}",
				data: {
					newpas:$("#psw").val(),
					phone:$("#phone").val()
				},
				dataType:"text",
				type:"post",
				success:function(data){
					if(data=="true"){
						window.location.href = "{:url('Index/login')}";
						alert("修改成功")
					}else{
						alert("修改失败")
					}
				},
				error:function(e){
					alert(e.response)
				}
			})
	})
	function yzyam(){
//		alert($("#yzm").val());
//		alert(yzm);
//		alert($("#yzm").val()==yzm);
		if($("#yzm").val()==yzm){
			$("#newpas").css("display","block")
		}
	}
</script>

